package com.kingsoft.demo.jxl;

import java.io.File;

import jxl.Workbook;
import jxl.format.Colour;
import jxl.format.UnderlineStyle;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

/**
 * 输出XLS
 * 
 * @author kbl
 *
 */
public class JxlWrite {
	
	public static void main(String[] args) throws Exception{
		
		//String path = JxlWrite.class.getResource("").getPath()+"1.xls";
		//System.out.println("path:"+path);
		
		File file = new File("src/com/kingsoft/demo/jxl/t1.xls");
		
		WritableWorkbook wbook = Workbook.createWorkbook(file);
		WritableSheet sheet = wbook.createSheet("第一页",0);
		
		WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16,
                WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,
                Colour.BLACK);
		
		WritableCellFormat wcfFC = new WritableCellFormat(wfont);
        sheet.addCell(new Label(1, 0, "选课学生列表", wcfFC));

		
        
        
		
		sheet.addCell(new Label(0, 2, "课程名称",new WritableCellFormat(new WritableFont(WritableFont.createFont("黑体")))));
		sheet.addCell(new Label(1, 2, "学 号"));
		sheet.addCell(new Label(2, 2, "姓 名"));
		sheet.addCell(new Label(3, 2, "性 别"));
		sheet.addCell(new Label(4, 2, "学 院"));
		sheet.addCell(new Label(5, 2, "班 级"));
		sheet.addCell(new Label(6, 2, "专 业"));
		sheet.addCell(new Label(7, 2, "备 注"));

		
		
		
		
		wbook.write();
		wbook.close();
		
	}

}
